<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="UTF-8">
    <title>详情</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">



</head>
<body>

<form method="post" th:action="@{/order/addOrder}">
    <!--    <div th:insert="~{public/publicTop::top}"></div>-->

    <div style="width: 70%; text-align: center;margin: auto;">

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>支付</legend>
        </fieldset>
        <table class="layui-table" lay-skin="line">
            <colgroup>
                <col width="150">
                <col width="150">
                <col width="200">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th style="width: 40%">商品名</th>
                <th style="width: 10%"></th>
                <th style="width: 20%">颜色</th>
                <th style="width: 30%">单价</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="buy:${buys}">
                <td th:text="${buy.getName()}"> </td>
                <td><img th:src="@{'/img/'+${buy.getImg()}}"></td>
                <td th:text="${buy.getColor()}"> </td>
                <td th:text="${buy.getPrice()}"> </td>
            </tr>
            </tbody>
        </table>
        <input type="hidden" name="gid" th:value="${gids}">
        <input type="hidden" name="ocolor" th:value="${colors}">
        <input type="hidden" name="omoney" th:value="${sum}">
        <div class="layui-form-item layui-form" style="left: 0px">
            <h3 class="layui-form-label">配送地址</h3>
            <div class="layui-input-block">
                <select name="address">
                    <option th:each="address:${addresses}"  th:value="${address.getId()}" >
                        <p th:text="${address.getName()}"></p>
                        <p th:text="${address.getPhone()}"></p>
                        <p th:text="${address.getAddress()}"></p>
                        <a th:href="@{'/account/edit/'+${address.getId()}}" class="glyphicon glyphicon-pencil"></a>&nbsp;&nbsp;
                    </option>
                </select>
            </div>
            <a class="btn btn-success btn1" th:href="@{/account/toadd}">+ 添加收货地址</a>
        </div>
        <h2 style="color: #f25807">总价</h2><h3 th:text="${sum}"></h3>
        <input type="submit" style="background-color: #f25807" class="layui-btn" value="结算">
        <a th:href="@{/buy/car}"><button type="button" class="layui-btn layui-btn-primary">返回</button></a>
    </div>

</form>

</body>
<script th:src="@{/layui/layui.js}"></script>
<script >
    layui.use('form', function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        form.render();
    });

    function selectALl(a){
        var s=document.getElementsByName("shangPin");
        console.log(s);
        for (var sElement of s) {
            sElement.checked=a.checked;
        }
    }
</script>
</html>